<template>
	<view class="">
		<view class="tit">
			<view class="tit_tile">
				注册
			</view>
			<view class="tit_name">
				请您输入账号密码进行注册
			</view>
		</view>

		<view class="log dashed-top dashed-bottom">
			<view class="cu-form-group">
				<view class="title">账　　号:</view>
				<input placeholder="请输入姓名" v-model="name" type="text"></input>
			</view>
			<view class="cu-form-group">
				<view class="title">密　　码:</view>
				<input placeholder="请输入密码" v-model="password" type="text"></input>
			</view>
		</view>

		<view class="location">
			<view class="padding flex flex-direction">
				<button class="cu-btn bg-green margin-tb-sm lg" @click="register">注册</button>
			</view>
			<view class="text-center text-xl" @click="returnLo">
				已有账号去登录
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				//姓名
				name: 'admin',
				// 密码
				password: '123456',
			}
		},
		methods: {
			//注册
			async register() {
				let data = {
					username: this.name,
					password: this.password
				}
				let res = await this.$operate.uniCloud('h5_register', data);
				console.log(res);
				this.$operate.toast({
					title: res.result.msg
				})
			},
			returnLo() {
				uni.navigateBack({
					delta: 1
				})
			}
		},
	}
</script>

<style lang="scss">
	page {
		background-color: #FFFFFF;
	}

	.tit {
		height: 200rpx;
		padding-top: 50rpx;
		// background-color: #F0AD4E;
		// line-height: 200rpx;
		text-align: center;

		.tit_tile {
			font-size: 45rpx;
			color: #333333;
		}

		.tit_name {
			font-size: 35rpx;
			color: #c3bcbc;
			margin-top: 25rpx;
		}
	}

	.log {
		margin-top: 50rpx;
		padding-left: 30rpx;
		padding-right: 30rpx;
	}

	.location {
		width: 100%;
		position: fixed;
		bottom: 100rpx;
	}

	.location_bttom {
		position: fixed;
		bottom: 10rpx;
		// background-color: #007AFF;
		width: 100%;
		height: 100rpx;
		display: flex;
		align-items: center;
		justify-content: center;

		.name {
			font-size: 30rpx;
			color: #5481a0;
		}
	}
</style>
